import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/commodity/classificationManagement/page/classificationDetail/provider/classification_detail_provider.dart';
import 'package:boss/ui/page/commodity/material/page/materialPicker/material_picker_page.dart';
import 'package:boss/ui/widget/title_row_button.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class ClassificationDetailMaterialHeader extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return TitleRowButton(
      title: '加料设置',
      value: '请选择',
      subTitle: '本分类下的菜品统一使用的加料',
      valueTextStyle: TextStyleConstant().blue_28,
      onTap: () async {
        var classificationDetailProvider = Provider.of<ClassificationDetailProvider>(
          context,
          listen: false,
        );
        var result = await Navigator.pushNamed(context, MaterialPickerPage.pageName, arguments: {
          'selectedMaterials': classificationDetailProvider.menu.commodityMeterialList,
        });
        if (result != null) {
          classificationDetailProvider.setMaterials(result);
        }
      },
    );
  }
}
